home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- if(move_delay >= 0)
- {
- move_delay--;
- }
- if(this.moveble && move_delay < 0)
- {
- if(c_path <= 0)
- {
- move_direction = -1;
- }
- if(c_path >= move_path)
- {
- move_direction = 1;
- }
- if(move_direction == 1)
- {
- c_path -= move_speed;
- _X = _X + move_speed * Math.sin(move_angle * 0.017453292519943295);
- _Y = _Y - move_speed * Math.cos(move_angle * 0.017453292519943295);
- }
- if(move_direction == -1)
- {
- c_path += move_speed;
- _X = _X - move_speed * Math.sin(move_angle * 0.017453292519943295);
- _Y = _Y + move_speed * Math.cos(move_angle * 0.017453292519943295);
- }
- }
- if(!_root.gameplay)
- {
- if(hitted)
- {
- if(_root.stoned)
- {
- hitted = false;
- }
- else
- {
- _root.do_sound("sHeart-steel",true);
- _root.bullet.vector = newa;
- hitted = false;
- to = false;
- trace(to);
- setTimeout(setto,100);
- _root.wl = "empty";
- }
- }
- x = Math.abs(_root.bullet._x + _root.bullet.vector.x * 0.9800000000000004 - (this._x + 12.5));
- y = Math.abs(_root.bullet._y - _root.bullet.vector.y * 0.9800000000000004 - _root.gravity - (this._y + 12.5));
- if(Math.sqrt(x * x + y * y) <= 25 && pretest && to)
- {
- delta_x = this._x + this._width / 2 - _root.bullet._x;
- delta_y = this._y + this._height / 2 - _root.bullet._y;
- a = (- Math.atan2(delta_x,delta_y)) / 0.017453292519943295;
- if(a > hAngle1 && a < hAngle2 or a > hAngle3 && a < hAngle4 or a > hAngle5 && a < hAngle6)
- {
- anglex = 1;
- angley = -0.9000000000000002;
- angle = a;
- pretest = false;
- }
- else if(a >= wAngle1 && a <= wAngle2 or a >= wAngle3 && a <= wAngle4 or a >= wAngle5 && a <= wAngle6)
- {
- anglex = -0.9000000000000002;
- angley = 1;
- angle = a;
- pretest = false;
- }
- }
- ti = 1;
- while(ti < 6)
- {
- x = _root.bullet._x + _root.bullet.vector.x / ti * 0.9800000000000004;
- y = _root.bullet._y - _root.bullet.vector.y / ti * 0.9800000000000004 - _root.gravity;
- if(this.hitTest(x,y,true) && to)
- {
- delta_x = this._x + this._width / 2 - _root.bullet._x;
- delta_y = this._y + this._height / 2 - _root.bullet._y;
- a = (- Math.atan2(delta_x,delta_y)) / 0.017453292519943295;
- if(a > hAngle1 && a < hAngle2 or a > hAngle3 && a < hAngle4 or a > hAngle5 && a < hAngle6)
- {
- anglex = 1;
- angley = -0.9000000000000002;
- angle = a;
- newa = {x:_root.bullet.vector.x * anglex,y:_root.bullet.vector.y * angley};
- pretest = true;
- }
- else if(a > wAngle1 && a < wAngle2 or a > wAngle3 && a < wAngle4 or a > wAngle5 && a < wAngle6)
- {
- anglex = -0.9000000000000002;
- angley = 1;
- angle = a;
- newa = {x:_root.bullet.vector.x * anglex,y:_root.bullet.vector.y * angley};
- pretest = true;
- }
- else if(a > dAngle1 && a < dAngle2 or a > dAngle3 && a < dAngle4)
- {
- anglex = -0.9000000000000002;
- angley = -0.9000000000000002;
- angle = a;
- newa = {x:_root.bullet.vector.x * anglex,y:_root.bullet.vector.y * angley};
- pretest = true;
- }
- hitted = true;
- break;
- }
- ti++;
- }
- i = 0;
- while(i < _root.tohit.length)
- {
- if(this.active && _root[_root.tohit[i]].active && this.hitTest(_root[_root.tohit[i]]._x,_root[_root.tohit[i]]._y,true))
- {
- obj = _root.tohit[i];
- _root.do_sound("sHeart-steel",true);
- _root[obj].speed = 0;
- _root[obj].active = false;
- _root[obj].gotoAndPlay(2);
- }
- i++;
- }
- }
- }
-